"""
DESCRIPTION
Calculates the number of different feature types in the specified feature matrix


ARGUMENTS
1. input feature matrix

CONTACT
timo.p.erkkila@tut.fi
http://www.cs.tut.fi/~erkkila2/
"""

import csv,sys,re

matrixreader = csv.reader(open(sys.argv[1],'r'),delimiter='\t')
matrixreader.next()

ftype_pos = 1
breakdown = {}

for line in matrixreader:

    ftype = re.split(':',line[0])[ftype_pos]
    
    if breakdown.get(ftype,'nan') == 'nan':
        breakdown[ftype] = 1
    else:
        breakdown[ftype] += 1

for key in breakdown.keys():
    print key+'\t'+str(breakdown[key])+'\n',
